package com.voole.focustest;

import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;

public class MainActivity extends Activity implements View.OnFocusChangeListener{

    private String TAG ="qkmin";
    private int Layout1 = R.id.id_fl;
    private int Layout2 = R.id.id_fl_2;
    private View onFousView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initViews();

    }

    private void initViews() {
        FrameLayout frameLayout=findViewById(Layout1);
        FrameLayout frameLayout2=findViewById(Layout2);
        onFousView = findViewById(R.id.id_focus);

        frameLayout.setOnFocusChangeListener(this);
        frameLayout2.setOnFocusChangeListener(this);
    }

    @Override
    public void onFocusChange(View v, boolean hasFocus) {
        if (hasFocus){
            Log.i(TAG,"onFocusChange"+v.getId());
            Tools.focusAnimator(v,onFousView);
        }
    }
}
